<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Product extends MX_Controller {


	function __construct(){

		$this->load->model('content/content_model');
		$this->load->model('product/product_model');
		$this->load->model('manager/manager_model');
	}
	
	function index(){

		$data['featured_product'] = $this->product_model->get_featured_product();

		$this->load->view('product/feature_product_content',$data);
	}
	
	function detail($product_seo_name){

		$data['detail'] = $this->product_model->select($product_seo_name);

		if (count($data['detail']) == 1){

			$product = $data['detail'][0];

			$product_id = $product->product_id;

			$data['product_options'] = $this->manager_model->get_product_option($product_id);

		}

		$data['store'] = $this->product_model->get_store_by_product($product_seo_name);

		$this->load->view('product/product_detail',$data);
	}
	
}

/* End of file common.php */